
from pymongo import MongoClient
from abc import abstractmethod
from pev2.util.DataBase import DB_CONN

"""
因子的基类。
"""

class BaseFactor:
    """
    初始化因子
    :param name: 因子名称
    """
    def __init__(self, name):
        self.name = name
        self.conn = DB_CONN[name]

    """
    计算指定周期内的因子值，并存入数据库
    :param startDate:  开始日期
    :param endDate:  结束日期
    """
    @abstractmethod
    def compute(self, startDate, endDate):
        pass